<?php
?>
<form id="form_edit_clockin_activity" enctype="multipart/form-data" method="post" action="#" class="form">
    <input type="hidden" name="form_sign_static" value="ok" />
    <input type="hidden" name="id" value=""/>
    <div class="wrapper-form">
        <dl class="row">
                        <dt class="tit">
                            <label for="activity_name"><em>*</em>活动名称</label>
                        </dt>
                        <dd class="opt"><input type="text" value="" name="activity_name" id="activity_name" class="input-txt" maxlength="50" />                <span class="err"></span>
                            <p class="notic"></p>
                        </dd>
                    </dl><dl class="row">
                        <dt class="tit">
                            <label for="description"><em>*</em>活动描述</label>
                        </dt>
                        <dd class="opt"><input type="text" value="" name="description" id="description" class="input-txt" maxlength="50" />                <span class="err"></span>
                            <p class="notic"></p>
                        </dd>
                    </dl>
        <dl class="row">
            <dt class="tit">
                <label>状态</label>
            </dt>
            <dd class="opt">
                <label><input type="radio" value="1" checked="checked" name="status">启用</label>
                <label><input type="radio" value="2" name="status">禁用</label>
                <span class="err"></span>
            </dd>
        </dl>
    </div>
</form>
<script>
    $(function(){
        var boxId = 'form_edit_clockin_activity';
        var subjectId = "<?php echo htmlentities($id); ?>";
        var menuOption = getMenuOption();
        var formFieldConfig = {
            parent_menu_id: {
                type: "select",
                config: {
                    width: 200,
                    height: 30,
                    data: menuOption,
                    textField: 'menu_name_cn',
                    valueField: 'id',
                }
            }
        };
        initFormElement(boxId, formFieldConfig);

        var loadData = getDetailInfo(subjectId);
        $("#" + boxId).form("load", loadData);

        function getDetailInfo(subjectId) {
            var data = {};
            $.ajax({
                url: '/api/clockin_activity/info',
                async: false,
                type: 'post',
                data: {id: subjectId},
                success: function (resp) {
                    if (1 == resp.code) {
                        data = resp.data;
                    }
                }
            });
            return data;
        }
    });
</script>